package com.liqi.sms.service.impl;

import com.liqi.common.utils.DateUtils;
import com.liqi.sms.domain.SysShortMessage;
import com.liqi.sms.mapper.SysShortMessageMapper;
import com.liqi.sms.service.ISysShortMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 短信管理Service业务层处理
 *
 * @author xiaoli
 * @date 2022-04-02
 */
@Service
public class SysShortMessageServiceImpl implements ISysShortMessageService
{
    @Autowired
    private SysShortMessageMapper sysShortMessageMapper;

    /**
     * 查询短信管理
     *
     * @param id 短信管理主键
     * @return 短信管理
     */
    @Override
    public SysShortMessage selectSysShortMessageById(Long id)
    {
        return sysShortMessageMapper.selectSysShortMessageById(id);
    }

    /**
     * 查询短信管理列表
     *
     * @param sysShortMessage 短信管理
     * @return 短信管理
     */
    @Override
    public List<SysShortMessage> selectSysShortMessageList(SysShortMessage sysShortMessage)
    {
        return sysShortMessageMapper.selectSysShortMessageList(sysShortMessage);
    }

    /**
     * 新增短信管理
     *
     * @param sysShortMessage 短信管理
     * @return 结果
     */
    @Override
    public int insertSysShortMessage(SysShortMessage sysShortMessage)
    {
        sysShortMessage.setCreateTime(DateUtils.getNowDate());
        return sysShortMessageMapper.insertSysShortMessage(sysShortMessage);
    }

    /**
     * 修改短信管理
     *
     * @param sysShortMessage 短信管理
     * @return 结果
     */
    @Override
    public int updateSysShortMessage(SysShortMessage sysShortMessage)
    {
        sysShortMessage.setUpdateTime(DateUtils.getNowDate());
        return sysShortMessageMapper.updateSysShortMessage(sysShortMessage);
    }

    /**
     * 批量删除短信管理
     *
     * @param ids 需要删除的短信管理主键
     * @return 结果
     */
    @Override
    public int deleteSysShortMessageByIds(Long[] ids)
    {
        return sysShortMessageMapper.deleteSysShortMessageByIds(ids);
    }

    /**
     * 删除短信管理信息
     *
     * @param id 短信管理主键
     * @return 结果
     */
    @Override
    public int deleteSysShortMessageById(Long id)
    {
        return sysShortMessageMapper.deleteSysShortMessageById(id);
    }

    @Override
    public List<SysShortMessage> selectSysShortMessageBySendFlag(String sendFlag) {
        return sysShortMessageMapper.selectSysShortMessageBySendFlag(sendFlag);
    }

    @Override
    public List<SysShortMessage> selectSysShortMessageByTime(String startTime, String endTime) {
        return sysShortMessageMapper.selectSysShortMessageByTime(startTime, endTime);
    }
}
